﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Carrot.Core.Logging
{
    /// <summary>
    /// It provides facility to log all information of running system.
    /// </summary>
    public interface ILogger
    {
        /// <summary>
        /// Check whether the logger is able to log for this <para>level</para>. 
        /// </summary>
        /// <param name="level">The type of logging information</param>
        bool IsEnabled(LogLevel level);

        /// <summary>
        /// Do logging information.
        /// </summary>
        /// <param name="level">The type of logging information</param>
        /// <param name="ex">The occurred exception</param>
        /// <param name="formatProvider">The format provider</param>
        /// <param name="format">The format string of logging message</param>
        /// <param name="parameters">Parameters should be passed for formatting</param>
        void Log(LogLevel level, Exception ex, IFormatProvider formatProvider, string format, params object[] parameters);
    }

    /// <summary>
    /// Defines type of logging information
    /// </summary>
    public enum LogLevel
    {
        /// <summary>
        /// Logging information for debugging purpose
        /// </summary>
        Debug,

        /// <summary>
        /// Information logs of running system.
        /// </summary>
        Information,

        /// <summary>
        /// Warnings logs
        /// </summary>
        Warning,

        /// <summary>
        /// Error logs
        /// </summary>
        Error,

        /// <summary>
        /// Fatal error logs
        /// </summary>
        Fatal
    }
}
